package com.csist.server;

import com.csist.model.Message;
import com.csist.model.User;
import com.csist.server.task.ServerRunnable;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.sql.Date;
import java.util.ArrayList;

/**
 * @ClassName Server
 * @Description TODO
 * @Author User
 * @Date 2021/6/14 1:17
 * @ModifyDate 2021/6/14 1:17
 * @Version 1.0
 */
public class Server {
    //存储在线的用户
    public static ArrayList<User> users = new ArrayList<>();
    public static void main(String[] args) {

        ServerSocket server = null;
        try {
            server = new ServerSocket(8888);
            System.out.println("服务器已启动");
                while (true){
                    Socket socket = server.accept();
                    System.out.println("监听到客户端");
                    new Thread(new ServerRunnable(socket)).start();
                }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
